﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using XYAuto.Utils.Data;

namespace XYAuto.MonitorData.Chitunion.Dal  
{
	
	 	//预警通知方式
		public partial class MonitorNoticeType : DataBase
	{
   		     
	
		  public static readonly MonitorNoticeType Instance = new MonitorNoticeType();
		  
		  
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Insert(Entities.MonitorNoticeType entity)
		{
            var strSql = new StringBuilder();
            strSql.Append("insert into MonitorNoticeType(");
            strSql.Append("NoticeKey,Desc,CreateTime,CreateUserId,UpdateTime,UpdateUserId");
            strSql.Append(") values (");
            strSql.Append("@NoticeKey,@Desc,@CreateTime,@CreateUserId,@UpdateTime,@UpdateUserId");
            strSql.Append(") ");
            strSql.Append(";select SCOPE_IDENTITY()");
            var parameters = new SqlParameter[]{
                        new SqlParameter("@NoticeKey",entity.NoticeKey),
                        new SqlParameter("@Desc",entity.Desc),
                        new SqlParameter("@CreateTime",entity.CreateTime),
                        new SqlParameter("@CreateUserId",entity.CreateUserId),
                        new SqlParameter("@UpdateTime",entity.UpdateTime),
                        new SqlParameter("@UpdateUserId",entity.UpdateUserId),
                        };


            var obj = SqlHelper.ExecuteScalar(CONNECTIONSTRINGS, CommandType.Text, strSql.ToString(), parameters);
            return obj == null ? 0 :

                Convert.ToInt32(obj);

        }
	}
}

